//
//  GYMySecondCell.m
//  GoodLuck
//
//  Created by apple on 2018/2/26.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

#import "GYMySecondCell.h"
#import "GYButton.h"
@interface GYMySecondCell ()

/** 积分按钮 */
@property (nonatomic, strong) GYButton *integralBtu;

@end
@implementation GYMySecondCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //初始化
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    self.integralBtu = [self creatGYButtonImage:@"mcc_10_b" title:@"积分" tag:1];
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    CGFloat btuW = ScreenWidth/5;
    self.integralBtu.frame = CGRectMake(0, 0, btuW, self.height);
}

- (GYButton *)creatGYButtonImage:(NSString *)imageName title:(NSString *)title tag:(NSInteger)tag {
    GYButton *btu = [GYButton button];
    [btu setImage:[UIImage imageNamed:imageName] forState:GYControlStateNormal];
    [btu setTitle:title forState:GYControlStateNormal];
    [btu setTitleColor:RGBColor(136, 158, 161) forState:GYControlStateNormal];
    btu.fontSize = 12;
    btu.imageSize = CGSizeMake(20, 20);
    btu.titleTopOrBottonMarginToSuperView = -10;
    btu.tag = tag;
    [btu addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:btu];
    
    return btu;
}

- (void)onClick:(GYButton *)sender {
    self.detailBlock(sender.tag);
}
@end
